﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace UFrame
{
    public class OUSelfDestroy : MonoBehaviour
    {
        public float time = 1f;
        public float counter = 0f;

        void Start()
        {
            counter = Time.realtimeSinceStartup;
        }

        void Update()
        {
            float t = Time.realtimeSinceStartup - counter;
            if (t >= time)
            {
                counter = Time.realtimeSinceStartup;
                this.gameObject.SetActive(false);
                GameObject.DestroyImmediate(gameObject);
            }
        }
    }
}